package com.point_of_sale.product;

public class WholesaleProduct extends Product 
{
	private Integer wholesaleNumber;
	private Float wholesalePrice;
	
	public WholesaleProduct()
	{
		super();
	}
	
	public Float getWholesalePrice() 
	{
		return wholesalePrice;
	}

	public void setWholesalePrice(Float wholesalePrice) 
	{
		this.wholesalePrice = wholesalePrice;
	}

	public Integer getWholesaleNumber() 
	{
		return wholesaleNumber;
	}

	public void setWholesaleNumber(Integer wholesaleNumber) 
	{
		this.wholesaleNumber = wholesaleNumber;
	}
	
	@Override
	public Float getPrice(Integer quantity) 
	{
		if(quantity/wholesaleNumber == 0)
		{
			return super.getPrice() * quantity;
		}
		else
		{
			return ((quantity/wholesaleNumber) * wholesalePrice) + (super.getPrice() * (quantity % wholesaleNumber));
		}
	}
}
